! Show all tags of type #theTag in a group box
! If not in a box, create it with label #label
! Use option-key to indent and ignore group box
sub TagBlock,#theTag,#label
  if #theTag is here
    if inGroupBox is false
      newline
      cell GroupBox,local(#label)
      width -1
      newline -#lineSkip-3
      #localBox="Yes"
    else
      #localBox="No"
    endif
    
    if #theTag<>"OBJE"
      #lineSkip=0
    endif
    ! set it but only used for OBJE
    #numURLs[0]=0
    
    ! Show all for this tag
    ShowAll #theTag
    
    ! Some records need _NOPOR for OBJE only
    if #theTag="OBJE" && @level=0
      if @rec="INDI" || @rec="FAM" || @rec="_PLC"
        Show _NOPOR
      endif
    endif
    
    ! end box if created
    if #localBox="Yes"
      EndGroup
    endif
    #lineSkip=#lineSkip$

    ! If found URLS for OBJEs, display them now
    ! In new box (for local box) or in same box (if not)
    if #theTag="OBJE" && #numURLs[0]>0
      if #localBox="Yes"
        cell GroupBox,local("Web Links")
        width -1
        newline -#lineSkip-3
        #lineSkip=0
      endif

      Repeat "#i",1,#numURLs[0]
        newline
        cell Multimedia
        #objeID=#numURLs[#i]
        set url @#objeID.FILE font "Hyperlink Text"
        if @#objeID.FILE.TITL<>""
          TextExpression @#objeID.FILE.TITL
        else
          TextExpression @#objeID.FILE
        endif
        set objectImage @#objeID imageposition left imageheight 22
        sizetofit -1
        #maxwidth=#rightMargin$-#rightSkip-21-#cellSkip-#hpos$
        if #cellWidth$>#maxwidth
          set width #maxwidth
        endif
        set height 22
        set help local("Click to open in browser")

        ! rest in a child window
        HMoveTo #rightMargin$-#rightSkip-21-#cellSkip
        cell LinkButton
        set border no width -1 image "details_here"
        RecordLink @#objeID
        set target child
        Help local("Click to view multimedia record")
      EndRepeat
      
      ! end box if created
      if #localBox="Yes"
        EndGroup
      endif
      #lineSkip=#lineSkip$
    endif
    
  endif
endsub